<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="father">
        <h1>标题一</h1>
        <p id="p1">p1</p>
        <p class="p2">p2</p>
    </div>


<script>
    'use strict'
    let h1 = document.getElementsByTagName('h1');
    let p1 = document.getElementById('p1');
    let p2 = document.getElementsByClassName('p2');
    let father = document.getElementById('father');
    // 获取父节点下所有的子节点
    let childrens = father.children;
    console.log(childrens);
    // 定位获取到一个节点之后就可以通过方法继续获得周围的节点，例如：
    father.firstChild
    father.lastChild;
</script>

</body>
</html>